import { request } from "@/utils/http"
import { Key } from "react"
import { HosSetPageListReturnType ,HosSetItemsParamsType,AddHospitalParamsType, uppdateHospitalParamsType} from "./model/hospitalSetType"

//获取医院分页列表
export const getHosSetPageListRequest = ({page,limit,hosname,hoscode}:HosSetItemsParamsType) => {
    return request.get<any,HosSetPageListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params:{
            hosname,
            hoscode
        }
    })
}

//新增医院
export const addHospitalRequest = (data:AddHospitalParamsType) => {
    return request.post<any,null>('/admin/hosp/hospitalSet/save',data)
}

//修改医院时获取当前医院信息
export const getHospitalFromIdRequest = (id:string) => {
    return request.get<any,AddHospitalParamsType>(`/admin/hosp/hospitalSet/get/${id}`)
}
//修改医院
export const updateHospitalRequest = (data:uppdateHospitalParamsType) => {
    return request.put<any,null>('/admin/hosp/hospitalSet/update',data)
}

//删除医院
export const deleteHospitalRequest = (id:number) => {
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

//批量删除医院
export const batchDeleteHospitalRequest = (data:Key[]) => {
    return request.delete<any,null>("/admin/hosp/hospitalSet/batchRemove",{
        data
    })
}